<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CdOrderModel extends BaseModel
{
    /**ruan shan chu deleted_at 软删除 */
    //use SoftDeletes;

    /**
     * Undocumented variable
     *
     * @var string
     */
    protected $table = 'order_cd';
    // protected $dates = ['deleted_at'];


    /**
     * 表明模型是否应该被打上时间戳
     *
     * @var bool
     */
    public $timestamps = true;


    /**
     * 获取用户订单列表
     *
     * @return void
     */
    public static function GetCdOrderList($pageSize, $page, $map, $sort, $type)
    {
        $orderList = self::select('*')
            ->where($map);
        if ($type == 1) {
            $orderList = $orderList->where('cd_status', 0);
        } else if ($type == 2) {
            $orderList = $orderList->where('cd_status', 1);
        }

        $orderList = $orderList->orderBy($sort[0], $sort[1])
            ->paginate($pageSize, [], 'page', $page)->toArray();
        return $orderList;
    }


    /**
     * 用户支付订单
     *
     * @return void
     */
    public static function UserStationPay()
    {
    }

    /**
     * 用户支付记录
     *
     * @return void
     */
    public static function UserStationPayRecords()
    {
    }



    /**
     * 用户订单详情
     *
     * @return void
     */
    public static function UserOrderDetail($id)
    {
        $orderInfo = self::select('*')
            ->where('id', $id)
            ->first();
        return $orderInfo;
    }


    /**
     * 用户结束订单
     *
     * @return void
     */
    public static function UserEndOrderList()
    {
    }
}
